<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Gods extends FOX_Controller {

	function __construct ()
	{
		parent::__construct();
		$this->load->model('category_m');
		$this->load->model('api_good_m');
		$this->load->model('member_m');
		$this->load->model('good_m');
		$this->load->model('shop_m');
		$this->load->model('areas_m');
		// $this->config->load('config');
	}
	public function index(){
		// $web_category = $this->uri->segment(3);
		$data['categorys'] = $this->category_m->get_cates_by_all_category(1);
		//good_voucher = 1免单
		$data['goods'] = $this->api_good_m->get_god_goods_list(0,$this->config->item('page_list_voucher'),1,'desc');
		if($data['goods']){
			foreach($data['goods'] as $k => $v){
				$data['goods'][$k]['count_orders'] = $this->api_good_m->count_shop_orders_count_by_good_id($v['good_id']);
			}
		}
		// pp($data);exit;
		$this->load->view('god_list',$data);
	}
}
